package uk.ac.open.kmi.dyniqx.mvc;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

public class QueryInterfaceController 
	extends AbstractController {
	
	public Logger logger = Logger.getLogger("uk.ac.open.kmi.dyniqx.mvc.QueryInterfaceController");
	
	private QueryInterfaceService qiService;
	
	public QueryInterfaceController() {
		this.logger.info("QueryInterfaceController constructor.");
	}
	
	protected ModelAndView handleRequestInternal (HttpServletRequest request, HttpServletResponse response)
		throws Exception {
			
		this.logger.info("Request received by QueryInterfaceController.");
				
		this.qiService.performQuery(request);
				
		return new ModelAndView("queryinterface");
	}
	
	public void setQiService(QueryInterfaceService qiService) {
		this.qiService = qiService;
	}
}